package com.gree.changying.activity.mainactivity.framgent.phfrm.adapter;

import android.widget.ImageView;
import android.widget.ProgressBar;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.gree.changying.R;
import com.gree.changying.activity.mainactivity.framgent.phfrm.bean.Paihan;

import java.util.List;

public class PhAdapter extends BaseQuickAdapter<Paihan, BaseViewHolder> {
    public PhAdapter(@LayoutRes int layoutResId, @Nullable List data) {
        super(layoutResId, data);
    }
    @Override
    protected void convert(BaseViewHolder helper, Paihan item) {
        ImageView img = helper.itemView.findViewById(R.id.img);
        Glide.with(mContext).load(item.getImg()).into(img);
        helper.setText(R.id.num,item.getNum()+"");
        helper.setText(R.id.name,item.getName());
        helper.setText(R.id.count1,item.getZcs()+"");
        helper.setText(R.id.count2,item.getHong()+"");
        helper.setText(R.id.count3,item.getHe()+"");
        helper.setText(R.id.count4,item.getHei()+"");
        helper.setText(R.id.count5,item.getSl()+"%");

        ProgressBar progressBar = helper.itemView.findViewById(R.id.progress);
        progressBar.setProgress(item.getSl());
        if(item.getNum()<=3){
            progressBar.setBackgroundResource(R.drawable.shape_progressbar);
        }else{
            progressBar.setBackgroundResource(R.drawable.shape_progressbar1);
        }
    }
}